package com.dragon.mmochat.message;

import com.dragon.mmochat.MmochatConstant;
import com.skymobi.buffer.SkymobiBuffer;
import com.skymobi.message.SkymobiProtocolMessage;

public class Mmochat_1_5C extends SkymobiProtocolMessage {
	int roleId;
	int clientVersion;
	int serverVersion;

	public Mmochat_1_5C() {
		setMsgCode(MmochatConstant.MSGCODE_MMOCHAT_C_1_5);
	}

	@Override
	protected void decodeBody(SkymobiBuffer in) {
		try {
			roleId = in.getInt();
			clientVersion = in.getShort();
			serverVersion = in.getInt();
		} catch (Exception e) {
			// 终端，服务端都升级版本后，旧版本终端可能上传协议时导致此处异常。出现异常，则认为版本不一致
			roleId = -1;
			clientVersion = -2;
			serverVersion = -2;
		}
	}

	public int getRoleId() {
		return roleId;
	}

	public int getClientVersion() {
		return clientVersion;
	}

	public int getServerVersion() {
		return serverVersion;
	}

}